from django.db import models


# Create your models here.


class Student(models.Model):
	sname = models.CharField(max_length=20)

	sage = models.IntegerField(default=0)
	saddr = models.CharField(max_length=20)
	saddr2 = models.CharField(max_length=20, default="")

	class Meta:
		db_table = "student"


# 定义图书模型类BookInfo
class BookInfo(models.Model):
	btitle = models.CharField(max_length=20, verbose_name='名称')
	bpub_date = models.DateField(verbose_name='发布日期')
	bread = models.IntegerField(default=0, verbose_name='阅读量')
	bcomment = models.IntegerField(default=0, verbose_name='评论量')
	is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

	class Meta:
		db_table = 'tb_books'  # 指明数据库表名
		verbose_name = '图书'  # 在admin站点中显示的名称
		verbose_name_plural = verbose_name  # 显示的复数名称

	def __str__(self):
		"""定义每个数据对象的显示信息"""
		return self.btitle
